package com.taiyuan.tongcheng.util;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * 
* @Description 偏好设置
* @author wzq
* @date 2015-7-23 下午7:47:37
* @update (date)
* @version V1.0
 */
public class SharePreferenceUtil {
	private SharedPreferences sp;
	private SharedPreferences.Editor editor;
	
	
	public SharePreferenceUtil(Context context, String file) {
		sp = context.getSharedPreferences(file, Context.MODE_PRIVATE);
		editor = sp.edit();
	}
	
     public void  setToken(String token){
    	 editor.putString("WEB_TOKEN", token);
     	 editor.commit();
     }
     public String getToken(){
    	 return sp.getString("WEB_TOKEN", "");
     }
     public void  setLoginToken(String token){
    	 editor.putString("WEB_LOG_TOKEN", token);
    	 editor.commit();
     }
     public String getLoginToken(){
    	 return sp.getString("WEB_LOG_TOKEN", "");
     }
     
     public void  setRegistrationID(String registrationID ){
    	 editor.putString("registrationID", registrationID);
    	 editor.commit();
     }
     public String getRegistrationID(){
      	 return sp.getString("registrationID", "");
     }
     
     public void  setLocationCity(String locationCity ){
    	 editor.putString("LocationCity", locationCity);
    	 editor.commit();
     }
     public String getLocationCity(){
      	 return sp.getString("LocationCity", "太原");
     }
     public void  setLocationCityCode(String locationCity ){
    	 editor.putString("LocationCityCode", locationCity);
    	 editor.commit();
     }
     public String getLocationCityCode(){
    	 return sp.getString("LocationCityCode", "");
     }
     
     public void  setLocationProvice(String locationCity ){
    	 editor.putString("LocationProvice", locationCity);
    	 editor.commit();
     }
     public String getLocationProvice(){
    	 return sp.getString("LocationProvice", "山西");
     }
     
     public void setLoginFlag(int flag){
    	 editor.putInt("login_flag", flag);
    	 editor.commit();
     }
     
     public int getLoginFlag(){
    	 return sp.getInt("login_flag", 0);
     }
     
     public void  setCacheOrderId(String orderId){
    	 editor.putString("acheOrderId", orderId);
    	 editor.commit();
     }
     
     public String getCacheOrderId(){
    	 return sp.getString("acheOrderId","");
     }
     
     public int getWaitTimes(){
    	 return sp.getInt("wait_times", 2);
     }
     
     public void setWaitTimes(int times){
    	 editor.putInt("wait_times", times);
    	 editor.commit();
     }
     
     public void setImExpireTime(long mill){
    	 editor.putLong("wait_mill", mill);
    	 editor.commit();
     }
     public long getImExpireTime(){
    	 return sp.getLong("wait_mill", 90000);
     }
     
     
     public void setSendUserName(String user){
    	 editor.putString("UserName", user);
    	 editor.commit();
     }
     
     public String getSendUserName(){
    	 return sp.getString("UserName","");
     }
     
     public void setSendUserPhone(String tel){
    	 editor.putString("tel", tel);
    	 editor.commit();
     }
     
     public String getSendUserPhone(){
    	 return sp.getString("tel","");
     }
     //==========搬家订单成功显示文字================
     
     public  void setBjOrderSucTv(String successInfo){
    	 editor.putString("BJSUC", successInfo);
    	 editor.commit();
     }
     
     public String getBJOrderSucTv(){
    	 return sp.getString("BJSUC","");
     }
     
     //=========================================
     
     public void setBjDiscount(String discount){
    	 editor.putString("discount", discount);
    	 editor.commit();
     }
     
     public String getBjDiscount() {
    	 return sp.getString("discount","9");
	 }
     
}
